package com.csxy.lsh.controller;

import com.csxy.lsh.R;
import com.csxy.lsh.service.VodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@RequestMapping("/eduvod/video")
public class EduVodController {
    public EduVodController() {
        System.out.println("=== EduVodController loaded ===");
    }
    @Autowired
    private VodService vodService;

    @PostMapping("/uploadAliyunVideo")
    public R uploadAliyunVideo(MultipartFile file){

        String videoId = vodService.uploadVideoAliyun(file);
        return R.ok().data("videoId",videoId);



    }

    @DeleteMapping("/removeAliyunVideoById/{id}")
    public R removeAliyunVideoById(@PathVariable String id) {
        vodService.removeAliyunVideoById(id);
        return R.ok();

    }
        @DeleteMapping("/removeBatch")
                public R removeBatch(@RequestParam("videoIdList") List<String> videoIdList){
            vodService.removeMoreVideo(videoIdList);
            return R.ok();
        }
    }

